/*
 * 字典
 */
import { postRequest, getRequest } from '/@/lib/axios';

export const dictApi = {
  //獲取缓存完整数据
  select: (serviceId) => {
    return getRequest(`/cache/common/select?serviceId=${serviceId}`);
  },
  //获取pKey对应缓存
  selectByParent: (serviceId,pKey) => {
    return getRequest(`/cache/common/selectByParent?serviceId=${serviceId}&pKey=${pKey}`);
  },
  //获取pKey对应缓存树
  selectTree: (serviceId,pKey) => {
    return getRequest(`/cache/common/selectTree?serviceId=${serviceId}&pKey=${pKey}`);
  },
  // 分页查询数据字典KEY
  keyQueryPage: (param) => {
    return postRequest('/sys/constant/searchPage', param);
  },
  // 数据字典key-更新
  keyEdit: (param) => {
    return postRequest('/sys/constant/save', param);
  },
  // 数据字典Value-删除
  valueDelete: (dictId) => {
    return postRequest(`/sys/constant/delete?id=${dictId}`);
  },
    // 缓存分页查询
    dictQueryPage: (param) => {
      return postRequest('/sys/cache/searchPage', param);
    },
    // 缓存分页查询
    doRefresh: (key) => {
      return getRequest(`/sys/cache/doRefresh?serviceId=${key}`);
    },
    loadSelect: () => {
      return getRequest(`/sys/cache/getCacheSelect`);
    },
};
